/**
 * @class Person
 * @constructor
 * @extends AbstractPerson
 * @param {Number} x 
 * @param {Number} y 
 * @param {String} gender 'M', 'F' or 'U' depending on the gender
 * @param {Number} id 
 * @param {Boolean} isProband 
 */

var Person = Class.create(AbstractPerson, {

    initialize: function($super, x, y, id, properties) {
        this._isProband = (properties.precursor == 1);
        !this._type && (this._type = "Person");
        this._setDefault();
        var gender = properties.hasOwnProperty("gender") ? properties['gender'] : "U";
        $super(x, y, gender, id);
        this.assignProperties(properties);
        var _this=this;
        document.observe("custom:cancer_window:open", function(target) {
            if(target.memo.person_id==_this.getID())
            {
                if(window.openFlag){
                    //_this.openCancerWindow(target.memo.cancer_type,target.memo.bPart);
                    _this.openCancerWindow(target.memo.cancer_type,target.memo.person_id,target.memo.bPart,target.memo.age,target.memo.ageType,target.memo.cancer_id,target.memo.m_personId);
                    window.openFlag = false;
                }
                
            }
        });
    },
    //设置家庭成员唯一标识
    setMpersonId:function(familyUserId){
        this.familyUserId = familyUserId;
    },
    //获取家庭成员唯一标识
    getMpersonId:function(){
        return this.familyUserId;
    },
    _setDefault: function() {
        this.familyUserId = "";
        this._dateOfAdd = JSON.parse(parent.$("#probandData").val()).dateOfAdd;
        this._telNum = "";
        this._bornAddr = "";
        this._ethnicityName = "";
        this._curentAge = "";
        this._deathAge = "";
        this._deceasedText = "";
        this._probability = "";
        this._lastName = "";
        this._lastNameAtBirth = "";
        this._birthDate = "";
        this._deathDate = "";
        this._conceptionDate = "";
        this._gestationAge = "";
        this._isAdopted = false;
        this._externalID = JSON.parse(parent.$("#probandData").val()).externalID;
        this._lifeStatus = 'alive';
        this._cancerAgeNum = null;
        this._highRelativeCancerName = null;
        this._urogenitalTumorName = null;
        this._gastrointestinalTumorName = null;
        this._otherTumorName = null;
        this._rareTumorName = null;
        this._childlessStatus = null;
        this._childlessReason = "";
        this._carrierStatus = "";
        this._disorders = [];
        this.nowdisorders=[];
        this._cancer = [];
        this._hpo = [];
        this._ethnicities = [];
        this._candidateGenes = [];
        this._twinGroup = null;
        this._monozygotic = false;
        this._evaluated = false;
        this._evaluatedinfo = "";
        this._pedNumber = "";
        this._lostContact = false;
        this._memberID=null;
        this._syndromeRate="";
        //新增部位文本框 lizhen
        this._getSiteOfCancerValue="";
        this._precursor = 0;
        this._cancerId = "";
    },

    /**
     * @method _generateGraphics
     * @param {Number} x 
     * @param {Number} y 
     * @return {PersonVisuals}
     * @private
     */
    _generateGraphics: function(x, y) {
        return new PersonVisuals(this, x, y);
    },

    /**
     *
     * @method isProband
     * @return {Boolean}
     */
    isProband: function() {
        return this._isProband;
    },

    /**
     *
     * @method getFirstName
     * @return {String}
     */
    getFirstName: function() {
        return this._firstName;
    },
	
    /**
     *
     * @method setFirstName
     * @param firstName
     */
    setFirstName: function(firstName) {
        var _personid = this.getID();
        this._firstName = firstName;
        this.getGraphics().updateNameLabel();
        //chen.yuguo 姓名跑偏
        this.getGraphics().updateEvaluatedInfoLabel();
        this.getGraphics().updateCommentsLabel();
        this.getGraphics().updateDisorderShapes();
        this.getGraphics().updateCancerNameLabel();  
        this.getauxbtn(_personid);
        
    },

    /**
     *
     * @method getLastName
     * @return {String}
     */
    getLastName: function() {
        return this._lastName;
    },
    
   /*
    * setAddDate,setTelephone, setBornAddr, setEthnicityName, setCurentAge, setDeathAge, setDeceasedReason, setProbability
    */
   	setAddDate: function(dateOfAddNew) {
        this._dateOfAdd = dateOfAddNew;
    },
    getAddDate: function() {
        return this._dateOfAdd;
    },
    setTelephone: function(telNumNew) {
        this._telNum = telNumNew;
    },
    getTelephone: function() {
        return this._telNum;
    },
    setBornAddr: function(bornAddrNew) {
        this._bornAddr = bornAddrNew;
    },
    getBornAddr: function() {
        return this._bornAddr;
    },
    setEthnicityName: function(ethnicityNameNew) {
        this._ethnicityName = ethnicityNameNew;
    },
    getEthnicityName: function() {
        return this._ethnicityName;
    },
    setCurentAge: function(curentAgeNew) {
        this._curentAge = curentAgeNew;
        this.getGraphics().updateNameLabel();
        this.getGraphics().updateEvaluatedInfoLabel();
        this.getGraphics().updateCommentsLabel();  
    },
    getCurentAge: function() {
        return this._curentAge;
    },
    setDeathAge: function(deathAgeNew) {
        this._deathAge = deathAgeNew;

        this.getGraphics().updateNameLabel();
        this.getGraphics().updateEvaluatedInfoLabel();
        this.getGraphics().updateCommentsLabel();        
    },
    getDeathAge: function() {
        return this._deathAge;
    },
    setDeceasedReason: function(deceasedTextNew) {
    		if(this.getLifeStatus() != null)
            reson = "";
        this._deceasedText = deceasedTextNew;
    },
    getDeceasedReason: function() {
        return this._deceasedText;
    },    
    setProbability: function(probabilityNew) {
   	    if(probabilityNew==this._probability) return;
        this._probability = probabilityNew;
        this.getGraphics().updateProbabilityLabel();
    },
    getProbability: function() {
        return this._probability;
    },

    /**
     *
     * @method setLastName
     * @param lastName
     */
    setLastName: function(lastName) {
        lastName && (lastName = lastName.charAt(0).toUpperCase() + lastName.slice(1));
        this._lastName = lastName;
        this.getGraphics().updateNameLabel();
        return lastName;
    },
    setMemberID: function(memberID) {
        this._memberID = memberID;
    },

    /**
     *
     * @method getExternalID
     * @return {String}
     */
    getExternalID: function() {
        return this._externalID;
    },
    getMemberID: function() {
        return this._memberID;
    },

    /**
     *
     * @method setPedNumber
     */
    setPedNumber: function(pedNumberString) {
        this._pedNumber = pedNumberString;
        this.getGraphics().updateNumberLabel();
    },

    /**
     *
     * @method getPedNumber
     * @return {String}
     */
    getPedNumber: function() {
        return this._pedNumber;
    },

    /**
     *
     * @method setExternalID
     * @param externalID
     */
    setExternalID: function(externalID) {
        this._externalID = externalID;
    },

    /**
     *
     * @method getLastNameAtBirth
     * @return {String}
     */
    getLastNameAtBirth: function() {
        return this._lastNameAtBirth;
    },

    /**
     *
     * @method setLastNameAtBirth
     * @param lastNameAtBirth
     */
    setLastNameAtBirth: function(lastNameAtBirth) {
        lastNameAtBirth && (lastNameAtBirth = lastNameAtBirth.charAt(0).toUpperCase() + lastNameAtBirth.slice(1));
        this._lastNameAtBirth = lastNameAtBirth;
        this.getGraphics().updateNameLabel();
        return lastNameAtBirth;
    },

    /**
     *
     * @method setComments
     * @param comment
     */
    setComments: function($super, comment) {
        if (comment != this.getComments()) {
            $super(comment);
            this.getGraphics().updateCommentsLabel();
            //chen.yuguo 姓名跑偏问题
           this.getGraphics().updateNameLabel();
            this.getGraphics().updateEvaluatedInfoLabel();
            this.getGraphics().updateDisorderShapes();
            this.getGraphics().updateCancerNameLabel(); 
        }
    },
    
    
    /**
     * Sets the type of twin
     *
     * @method setMonozygotic
     */
    setMonozygotic: function(monozygotic) {
        if (monozygotic == this._monozygotic) return;
        this._monozygotic = monozygotic;
    },

    /**
     *
     * @method getEvaluated
     * @return {Boolean}
     */
    getEvaluated: function() {
        return this._evaluated;
    },

    /**
     *
     * @method setEvaluated
     */
    setEvaluated: function(evaluationStatus) {
        if (evaluationStatus == this._evaluated) return;
        this._evaluated = evaluationStatus;
        this.getGraphics().updateEvaluationLabel();
        //chen.yuguo 姓名跑偏问题
        this.getGraphics().updateNameLabel();
        this.getGraphics().updateCommentsLabel();
        this.getGraphics().updateDisorderShapes();
        this.getGraphics().updateCancerNameLabel(); 
    },
    /*
    *setProband*
    */
    setProband:function(proband){
        if(!proband && this._precursor == 1){
            return;
        }else{     
            //更新先证者信息
            this.getGraphics().upDateProband();
            this._precursor = 1;
        }
        
       
       
    },
    getProband:function(){
        return this._precursor;
    },
    /**
     *
     * @method getEvaluatedInfo
     * @return {Boolean}
     */
    getEvaluatedInfo: function() {
        return this._evaluatedinfo;
    },

    /**
     *
     * @method setEvaluated
     */
    setEvaluatedInfo: function(evaluatedinfoStatus) {
        if (evaluatedinfoStatus == this._evaluatedinfo) return;
        this._evaluatedinfo = evaluatedinfoStatus;
        this.getGraphics().updateEvaluatedInfoLabel();
        //chen.yuguo 姓名跑偏
        this.getGraphics().updateNameLabel();
        this.getGraphics().updateCommentsLabel();
        this.getGraphics().updateDisorderShapes();
        this.getGraphics().updateCancerNameLabel(); 
    },
    /**
     *
     * @method getLostContact
     * @return {Boolean}
     */
    getLostContact: function() {
        return this._lostContact;
    },

    /**
     *
     * @method setLostContact
     */
    setLostContact: function(lostContact) {
        if (lostContact == this._lostContact) return;
        this._lostContact = lostContact;
    },

    /**
     *
     * @method getMonozygotic
     * @return {Boolean}
     */
    getMonozygotic: function() {
        return this._monozygotic;
    },
    /**
     * @method getUnknownzygotic
     * @return {Boolean}
     */
    getUnknownzygotic: function() {
        return this._unknownzygotic;
    },
    setUnknownzygotic: function(unknownzygotic) {
        if (unknownzygotic == this._unknownzygotic) return; 
        this._unknownzygotic = unknownzygotic;
    },

    /**
     *
     * @method setTwinGroup
     */
    setTwinGroup: function(groupId) {
        this._twinGroup = groupId;
    },

    /**
     *
     * @method getLifeStatus
     * @return {String} "alive", "deceased", "stillborn", "unborn", "aborted" or "miscarriage"
     */
    getLifeStatus: function() {
        return this._lifeStatus;
    },

    /**
     *
     * @method isFetus
     * @return {Boolean}
     */
    isFetus: function() {
        return (this.getLifeStatus() != 'alive' && this.getLifeStatus() != 'deceased');
    },

    /**
     *
     * @method _isValidLifeStatus
     * @param {String} status
     * @returns {boolean}
     * @private
     */
    _isValidLifeStatus: function(status) {
        return (status == 'unborn' || status == 'stillborn'
            || status == 'aborted' || status == 'miscarriage'
            || status == 'alive' || status == 'deceased')
    },

    /**
     *
     * @method setLifeStatus
     * @param {String} newStatus "alive", "deceased", "stillborn", "unborn", "aborted" or "miscarriage"
     */
    
    setLifeStatus: function(newStatus) {
        if(this._isValidLifeStatus(newStatus)) {
            var oldStatus = this._lifeStatus;

            this._lifeStatus = newStatus;

            (newStatus != 'deceased') && this.setDeathDate("");
            (newStatus == 'alive') && this.setGestationAge();
            this.getGraphics().updateSBLabel(); 
            if(this.isFetus()) {
                this.setBirthDate("");
                this.setAdopted(false);
                this.setChildlessStatus(null);
            }
            this.getGraphics().updateLifeStatusShapes(oldStatus);
            this.getGraphics().getHoverBox().regenerateHandles();
            this.getGraphics().getHoverBox().regenerateButtons();

            this.getGraphics().updateNameLabel();
            this.getGraphics().updateEvaluatedInfoLabel();
            this.getGraphics().updateCommentsLabel();  
        }
    },    
    
   	_isValidCancerAgeTypes: function(agetypes) {
        return ((agetypes == 'estimatedage' || agetypes == 'exactage'  || agetypes == 'none'  || agetypes == ''));
    },
    getCancerAgeType: function() {
        return this._cancerAgeType;
    },
    setCancerAgeType: function(newAgeType) {
        if (newAgeType == this._cancerAgeType) return;
        if(this._isValidCancerAgeTypes(newAgeType)) {
            this._cancerAgeType = newAgeType;
         }
        this.setCancerAgeNum("");
        this.getGraphics().updateCancerNameLabel();
    },
    
    getCancerAgeNum: function() {
		return this._cancerAgeNum;
    },
    setCancerAgeNum: function(currentCancerAgeNum) {
        if (currentCancerAgeNum == this._cancerAgeNum) return;
        this._cancerAgeNum = currentCancerAgeNum;
        this.getGraphics().updateCancerNameLabel();
    },
    // 新增部位文本框 lizhen
    getSiteOfCancerValue:function(){
        return this._getSiteOfCancerValue;
    },
    setSiteOfCancerValue:function(siteOfCancerValue){
        if(siteOfCancerValue == this._getSiteOfCancerValue) return;
        this._getSiteOfCancerValue=siteOfCancerValue;
        this.getGraphics().updateCancerNameLabel();
    },
    // 新增确定部位按钮 lizhen
    getCancerSite:function(){
        return this._okValue;
    },
    //点击部位确认按钮 lizhen
    setCancerSite: function(reason){
        var miancancerType =  this.getCancerTypes();
        var cancerType = "";
        //lizhen 2018-05-21 癌症类型判断
        switch (miancancerType) {
            case "cancertype1" :
                cancerType = this.getHighRelativeCancerName();
                break;
            case "cancertype2" :
                cancerType = this.getUrogenitalTumorName();
                break;
            case "cancertype3" :
                cancerType = this.getGastrointestinalTumorName();
                break;
            case "cancertype4" :
                cancerType = this.getOtherTumorName();
                break;
            case "cancertype5" :
                cancerType = this.getRareTumorName();
                break;
        }
        //切换癌症中英文
        if(cType.ctypeHigh[cancerType]){
            cancerType = cType.ctypeHigh[cancerType]
        }
        var cancerId = this.setCancerUuid();
        this.setCancerId(cancerId);
        var age = this.getCancerAgeNum();
        var ageType = this.getCancerAgeType();
        var bPart = this.getSiteOfCancerValue();
        this.addDisorder(cancerType,age,ageType,bPart,cancerId);
        this.getGraphics().updateDisorderShapes();
        this.getGraphics().updateCancerNameLabel();
    },
    //cancer uuid
    setCancerUuid:function(){
        var s = [];
        var hexDigits = "0123456789abcdef";
        for (var i = 0; i < 36; i++) {
            s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
        }
        s[14] = "4";  // bits 12-15 of the time_hi_and_version field to 0010
        s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1);  // bits 6-7 of the clock_seq_hi_and_reserved to 01
        s[8] = s[13] = s[18] = s[23] = "-";
        var uuid = s.join("");
        return uuid;
    },
    setCancerId:function(cancerId){
        if(this.getCancerId() != cancerId){
            this._cancerId = cancerId
        }
    },
    getCancerId:function(){
        return this._cancerId;
    },
    setCancerAuxiliaryInfo: function (showCancerAuxinfo) {
    		this._showCancerAuxinfo = showCancerAuxinfo;
        if(showCancerAuxinfo){
        }
        else{
        }
    },
    isHighRelativeCancer: function() {
        return (this.getCancerTypes() != 'cancertype2' && this.getCancerTypes() != 'cancertype3'&& this.getCancerTypes() != 'cancertype4'&& this.getCancerTypes() != 'cancertype5');
    },
   	_isValidCancerTypes: function(cancertypes) {
        return (cancertypes == 'cancertype1' || cancertypes == 'cancertype2'
            || cancertypes == 'cancertype3' || cancertypes == 'cancertype4'
            || cancertypes == 'cancertype5' || cancertypes == null)
    },
    getCancerTypes: function() {
		return this._cancerTypes;
    },
    setCancerTypes: function(newTypes) {
        if(this._isValidCancerTypes(newTypes)) {
            var oldCancerTypes = this._cancerTypes;
            this._cancerTypes = newTypes;
            (newTypes != 'cancertype1') && this.setCancerAuxiliaryInfo(false);
            (newTypes == 'cancertype1') && this.setHighRelativeCancerName();
            (newTypes == 'cancertype2') && this.setUrogenitalTumorName();
            (newTypes == 'cancertype3') && this.setGastrointestinalTumorName();
            (newTypes == 'cancertype4') && this.setOtherTumorName();
            (newTypes == 'cancertype5') && this.setRareTumorName();
            if(this.isHighRelativeCancer()) {
                this.setHighRelativeCancerName();
                this.setUrogenitalTumorName(null);
                this.setGastrointestinalTumorName(null);
                this.setOtherTumorName(null);
                this.setRareTumorName(null);
                this.setUrogenitalTumorName(null);
            }
            this.getGraphics().updateCancerNameLabel();
        } else {
        		this._cancerTypes = null;
        		this.getGraphics().updateCancerNameLabel();
        }
        
    },
    _isValidHighRelativeCancerName: function(highRelativeCancerName) {
        return (highRelativeCancerName == 'highcancer_rxa' || highRelativeCancerName == 'highcancer_lca'
        || highRelativeCancerName == 'highcancer_zgnma' || highRelativeCancerName == 'highcancer_jzca'
        || highRelativeCancerName == 'highcancer_wa'
        || highRelativeCancerName == 'highcancer_sa'
        || highRelativeCancerName == 'highcancer_qlxa'
        || highRelativeCancerName == 'highcancer_jzxa'
        || highRelativeCancerName == 'highcancer_yxa'
        || highRelativeCancerName == '乳腺癌'
        || highRelativeCancerName == '卵巢癌'
        || highRelativeCancerName == '子宫内膜癌'
        || highRelativeCancerName == '结直肠癌'
        || highRelativeCancerName == '胃癌'
        || highRelativeCancerName == '前列腺癌'
        || highRelativeCancerName == '肾癌'
        || highRelativeCancerName == '甲状腺癌'
        || highRelativeCancerName == '胰腺癌')
    },
    _isValidUrogenitalTumorName: function(urogenitalTumorName) {
        return (urogenitalTumorName == '卵巢纤维肉瘤'
        || urogenitalTumorName == '卵巢伴环状小管性索瘤'
        || urogenitalTumorName == '高钙血型小细胞卵巢癌'
        || urogenitalTumorName == '输卵管癌'
        || urogenitalTumorName == '肾上腺皮质癌'
        || urogenitalTumorName == '肾血管平滑肌脂肪瘤'
        || urogenitalTumorName == '膀胱癌'
        || urogenitalTumorName == '胆管癌'
        || urogenitalTumorName == '输尿管癌'
        || urogenitalTumorName == '肾盂肾癌'
        || urogenitalTumorName == '尿路癌'
        || urogenitalTumorName == '睾丸癌'
        || urogenitalTumorName == '睾丸支持细胞瘤'
        || urogenitalTumorName == '睾丸大细胞钙化型支持细胞瘤'
        || urogenitalTumorName == '宫颈癌'
        || urogenitalTumorName == '宫颈恶性腺瘤')
    },
    _isValidGastrointestinalTumorName: function(gastrointestinalTumorName) {
        return (gastrointestinalTumorName == '胃肠间质瘤'
        || gastrointestinalTumorName == '胃肠道错构瘤'
        || gastrointestinalTumorName == '胃肠道弥漫性神经节瘤病'
        || gastrointestinalTumorName == '食管癌'
        || gastrointestinalTumorName == '肝癌'
        || gastrointestinalTumorName == '胆囊癌'
        || gastrointestinalTumorName == '小肠癌')
    },

    _isValidOtherTumorName: function(otherTumorName) {
        return (otherTumorName == '肺癌'
        || otherTumorName == '脑瘤'
        || otherTumorName == '神经胶质瘤'
        || otherTumorName == '白血病'
        || otherTumorName == '霍奇金淋巴瘤'
        || otherTumorName == '非霍奇金淋巴瘤'
        || otherTumorName == '黑色素瘤'
        || otherTumorName == '皮肤癌'
        || otherTumorName == '鼻咽癌'
        || otherTumorName == '喉头癌'
        || otherTumorName == '舌癌'
        || otherTumorName == '骨癌'
        || otherTumorName == '原发性腹膜癌')
    },
    _isValidRareTumorName: function(rareTumorName) {
        return (rareTumorName == '儿童肉瘤'
        || rareTumorName == '骨肉瘤'
        || rareTumorName == '软组织肉瘤'
        || rareTumorName == '神经节瘤'
        || rareTumorName == '副神经节瘤'
        || rareTumorName == '嗜铬细胞瘤'
        || rareTumorName == '心脏横纹肌瘤'
        || rareTumorName == '横纹肌肉瘤'
        || rareTumorName == '脉络丛癌'
        || rareTumorName == '砂粒性黑色素神经鞘瘤'
        || rareTumorName == '淋巴管肌瘤病'
        || rareTumorName == '内淋巴囊肿瘤'
        || rareTumorName == '巨细胞星形细胞瘤'
        || rareTumorName == '皮肤和黏膜粘液瘤'
        || rareTumorName == '心肌粘液瘤'
        || rareTumorName == '乳腺粘液瘤'
        || rareTumorName == '骨软骨粘液瘤'
        || rareTumorName == '神经纤维瘤'
        || rareTumorName == '丛状神经纤维瘤'
        || rareTumorName == '面部血管纤维瘤'
        || rareTumorName == '甲周纤维瘤'
        || rareTumorName == '牙龈纤维瘤'
        || rareTumorName == '视网膜结节状错构瘤'
        || rareTumorName == '视网膜毛细血管瘤'
        || rareTumorName == '视网膜母细胞瘤'
        || rareTumorName == '恶性胶质瘤'
        || rareTumorName == '视神经胶质瘤'
        || rareTumorName == '毛鞘瘤'
        || rareTumorName == '皮肤黏膜神经瘤'
        || rareTumorName == '眼部神经瘤'
        || rareTumorName == '口腔神经瘤'
        || rareTumorName == '口腔乳头瘤'
        || rareTumorName == '皮脂腺瘤'
        || rareTumorName == '角化棘皮瘤'
        || rareTumorName == '细支气管肺泡癌'
        || rareTumorName == '硬纤维瘤'
        || rareTumorName == '脂肪瘤'
        || rareTumorName == '甲状腺腺瘤'
        || rareTumorName == '乳腺导管腺瘤'
        || rareTumorName == '中枢神经系统血管膜细胞瘤'
        || rareTumorName == '肝母细胞瘤')
    },
    getHighRelativeCancerName: function() {
		return this._highRelativeCancerName;
    },  
    getCurrentPersonD: function() {
    		this._currentPersonid = this.getID();
        return this._currentPersonid;
    },
    getGeneticSyndrome: function() {
        return this._geneticSyndromeNew;
    },
    setGeneticSyndrome: function() {
        this.openCancerWindow(10);
    },
    //chen.yuguo  上传文件，图片信息
    getGeneticFile: function() {
        return this._genetic_file;
    },
    setGeneticFile: function() {cancer_file_url
        var current_personid = sessionStorage.getItem("_current_personid");
        var genetic_syndrome_url = cancer_file_url+"?person_id="+current_personid;
        var genetic_syndrome_window = window.open();
        editor.getSaveLoadEngine().saveSilence(function(){
            genetic_syndrome_window.location=genetic_syndrome_url;
            //window.open(genetic_syndrome_url, '_blank');
        });
    },
    getCurrentCancerType:function(type){
        var ret = "";
        if(type == "乳腺癌"){
            ret = "1";
        }else if(type == "卵巢癌"){
            ret = "2";
        }else if(type == "结直肠癌"){
            ret = "3";
        }else if(type == "胃癌"){
            ret = "4";
        }else if(type == "子宫内膜癌"){
            ret = "5";
        }else if(type == "前列腺癌"){
            ret = "6";
        }else if(type == "胰腺癌"){
            ret = "7";
        }else if(type == "甲状腺癌"){
            ret = "8";
        }else if(type == "肾癌"){
            ret = "9";
        }
        return ret;
    },
    //openCancerWindow:function (type,bPart) {
    openCancerWindow:function (type,personid,bPart,age,ageType,cancerId,m_personId) {
        if(!type)
            return false;
        //this.getGraphics().getHoverBox().getNode().getGraphics().getHoverBox().setHighlighted(false);
        var current_personid =personid ? personid : sessionStorage.getItem("_current_personid");
        var familyTreeId = parent.$("#familyTreeId").val();
        var familyUserId = m_personId ? m_personId : this.getMpersonId();
        //lizhen 2018-05-22 添加部位参数跳转
        var bpart = bPart ? encodeURI(bPart) : "";
        var age = age ? encodeURI(age) : "";
        var ageType = ageType ? encodeURI(ageType) : "";
        if(type == 1){
            var url="/rxa?familyTreeId="+familyTreeId+"&current_personid="+familyUserId+"&type="+type+"&cancerId="+cancerId+"";
        }else if(type == 2){
            var url="/lca?familyTreeId="+familyTreeId+"&current_personid="+familyUserId+"&type="+type+"&cancerId="+cancerId+"";
        }else if(type == 3){
            var url="/jzca?familyTreeId="+familyTreeId+"&current_personid="+familyUserId+"&type="+type+"&cancerId="+cancerId+"";
        }else if(type == 4){
            var url="/wa?familyTreeId="+familyTreeId+"&current_personid="+familyUserId+"&type="+type+"&cancerId="+cancerId+"";
        }else if(type == 5){
            var url="/zgnma?familyTreeId="+familyTreeId+"&current_personid="+familyUserId+"&type="+type+"&cancerId="+cancerId+"";
        }else if(type == 6){
            var url="/qlxa?familyTreeId="+familyTreeId+"&current_personid="+familyUserId+"&type="+type+"&cancerId="+cancerId+"";
        }else if(type == 7){
            var url="/yxa?familyTreeId="+familyTreeId+"&current_personid="+familyUserId+"&type="+type+"&cancerId="+cancerId+"";
        }else if(type == 8){
            var url="/jzxa?familyTreeId="+familyTreeId+"&current_personid="+familyUserId+"&type="+type+"&cancerId="+cancerId+"";
        }else if(type == 9){
            var url="/sa?familyTreeId="+familyTreeId+"&current_personid="+familyUserId+"&type="+type+"&cancerId="+cancerId+"";
        }else if(type == 10){
            var url="/health?familyTreeId="+familyTreeId+"&current_personid="+familyUserId+"&type="+type+"&cancerId="+cancerId+"";
        }


        var genetic_syndrome_window = window.open();
        genetic_syndrome_window.location=url;
        
        // var genetic_syndrome_url = cancer_edit_url+"?type="+type+"&person_id="+current_personid+"&bPart="+bpart+"&age="+age+"&ageType="+ageType;
        // var genetic_syndrome_window = window.open();
        // editor.getSaveLoadEngine().saveSilence(function(){
        //     genetic_syndrome_window.location=genetic_syndrome_url;
        //     //window.open(genetic_syndrome_url, '_blank');
        // });
    },
	getauxbtn: function(personid){
		var me = this;
		var _current_personid = personid;
		var _probandFirstName = JSON.parse(parent.$("#pedigreeData").val())[0].firstName;
		sessionStorage.setItem("_current_personid", _current_personid);
		sessionStorage.setItem("_probandFirstName", _probandFirstName);
		
	},
	geneticFyndromeBtn: function(){
		var current_personid = this.getID();
		var genetic_syndrome_url = "./cancerinfo/html/genetic_syndrome.html?personid=" + current_personid;
		window.open(genetic_syndrome_url, '_blank');
	},
    setHighRelativeCancerName: function(newHighRelativeCancerName,cancerInfo) {
		if(!this._isValidHighRelativeCancerName(newHighRelativeCancerName))
		            newHighRelativeCancerName = null;
		var _personid = this.getID();
		if(newHighRelativeCancerName != this.getHighRelativeCancerName()) {
			var oldHighRelativeCancerName = this._highRelativeCancerName;
            this._highRelativeCancerName = newHighRelativeCancerName;
            this.getauxbtn(_personid);
            if(newHighRelativeCancerName){
                if(newHighRelativeCancerName =="highcancer_rxa" ){ var highCancerListName = "乳腺癌";}
                else if(newHighRelativeCancerName =="highcancer_lca" ){ var highCancerListName = "卵巢癌";}
                else if(newHighRelativeCancerName =="highcancer_zgnma" ){ var highCancerListName = "子宫内膜癌";}
                else if(newHighRelativeCancerName =="highcancer_jzca" ){ var highCancerListName = "结直肠癌";}
                else if(newHighRelativeCancerName =="highcancer_wa" ){ var highCancerListName = "胃癌";}
                else if(newHighRelativeCancerName =="highcancer_sa" ){ var highCancerListName = "肾癌";}
                else if(newHighRelativeCancerName =="highcancer_qlxa" ){ var highCancerListName = "前列腺癌";}
                else if(newHighRelativeCancerName =="highcancer_jzxa" ){ var highCancerListName = "甲状腺癌";}
                else if(newHighRelativeCancerName =="highcancer_yxa" ){ var highCancerListName = "胰腺癌";}

                else if(newHighRelativeCancerName =="乳腺癌" ){ var highCancerListName = "乳腺癌";}
                else if(newHighRelativeCancerName =="卵巢癌" ){ var highCancerListName = "卵巢癌";}
                else if(newHighRelativeCancerName =="子宫内膜癌" ){ var highCancerListName = "子宫内膜癌";}
                else if(newHighRelativeCancerName =="结直肠癌" ){ var highCancerListName = "结直肠癌";}
                else if(newHighRelativeCancerName =="胃癌" ){ var highCancerListName = "胃癌";}
                else if(newHighRelativeCancerName =="肾癌" ){ var highCancerListName = "肾癌";}
                else if(newHighRelativeCancerName =="前列腺癌" ){ var highCancerListName = "前列腺癌";}
                else if(newHighRelativeCancerName =="甲状腺癌" ){ var highCancerListName = "甲状腺癌";}
                else if(newHighRelativeCancerName =="胰腺癌" ){ var highCancerListName = "胰腺癌";}
                if(typeof cancerInfo=="undefined")
                    age='';
                else
                    age=cancerInfo.age;
                if(typeof cancerInfo=="undefined")
                    ageType='';
                else
                    ageType=cancerInfo.ageType;
                //lizhen  2018-05-21
                //this.addDisorder(highCancerListName,age,ageType);
            
            }
            //lizhen  2018-05-21
            //this.getGraphics().updateDisorderShapes();
            //this.getGraphics().updateCancerNameLabel();
            //chen.yuguo 姓名跑偏问题
            this.getGraphics().updateNameLabel();
           this.getGraphics().updateEvaluatedInfoLabel();
           this.getGraphics().updateCommentsLabel();               
        }
		return this.getHighRelativeCancerName();
		
    },
    
    getUrogenitalTumorName: function() {
  		return this._urogenitalTumorName;
    },
    setUrogenitalTumorName: function(newUrogenitalTumorName,cancerInfo) {
       	var _personid = this.getID();
		var oldUrogenitalTumorName = this._urogenitalTumorName;
        this._urogenitalTumorName = newUrogenitalTumorName;        
        if(newUrogenitalTumorName){
            if(typeof cancerInfo=="undefined")
                age='';
            else
                age=cancerInfo.age;
            if(typeof cancerInfo=="undefined")
                ageType='';
            else
                ageType=cancerInfo.ageType;
            //lizhen  2018-05-21
            //this.addDisorder(newUrogenitalTumorName,age,ageType);
        }
        //lizhen  2018-05-21
        this.getGraphics().updateDisorderShapes();
        	this.getGraphics().updateCancerNameLabel();
            //chen.yuguo 姓名跑偏问题
            this.getGraphics().updateNameLabel();
           this.getGraphics().updateEvaluatedInfoLabel();
           this.getGraphics().updateCommentsLabel();    
    },
    getGastrointestinalTumorName: function() {
  		return this._gastrointestinalTumorName;
    },
    setGastrointestinalTumorName: function(newGastrointestinalTumorName,cancerInfo) {
    		var _personid = this.getID();
		var oldGastrointestinalTumorName = this._gastrointestinalTumorName;
        this._gastrointestinalTumorName = newGastrointestinalTumorName;
        if(newGastrointestinalTumorName){
            if(typeof cancerInfo=="undefined")
                age='';
            else
                age=cancerInfo.age;
            if(typeof cancerInfo=="undefined")
                ageType='';
            else
                ageType=cancerInfo.ageType;
            //lizhen  2018-05-21
            //this.addDisorder(newGastrointestinalTumorName,age,ageType);
        }
        //this.getGraphics().updateDisorderShapes();
        	//this.getGraphics().updateCancerNameLabel();
            //chen.yuguo 姓名跑偏问题
            this.getGraphics().updateNameLabel();
           this.getGraphics().updateEvaluatedInfoLabel();
           this.getGraphics().updateCommentsLabel();
    },
    getOtherTumorName: function() {
  		return this._otherTumorName;
    },
    setOtherTumorName: function(newOtherTumorName,cancerInfo) {
   	 	var _personid = this.getID();
		var oldOtherTumorName = this._otherTumorName;
        this._otherTumorName = newOtherTumorName;
        if(newOtherTumorName){
            if(typeof cancerInfo=="undefined")
                age='';
            else
                age=cancerInfo.age;
            if(typeof cancerInfo=="undefined")
                ageType='';
            else
                ageType=cancerInfo.ageType;
            //lizhen  2018-05-21
            // this.addDisorder(newOtherTumorName,age,ageType);
        }
        // this.getGraphics().updateDisorderShapes();
        // this.getGraphics().updateCancerNameLabel();
        //chen.yuguo 姓名跑偏问题
            this.getGraphics().updateNameLabel();
           this.getGraphics().updateEvaluatedInfoLabel();
           this.getGraphics().updateCommentsLabel();    
    },
    getRareTumorName: function() {
  		return this._rareTumorName;
    },
    setRareTumorName: function(newRareTumorName,cancerInfo) {
    		var _personid = this.getID();
		var oldRareTumorName = this._rareTumorName;
        this._rareTumorName = newRareTumorName;
        if(newRareTumorName){
            if(typeof cancerInfo=="undefined")
                age='';
            else
                age=cancerInfo.age;
            if(typeof cancerInfo=="undefined")
                ageType='';
            else
                ageType=cancerInfo.ageType;
            //lizhen  2018-05-21
            // this.addDisorder(newRareTumorName,age,ageType);
        }
        // this.getGraphics().updateDisorderShapes();
        // 	this.getGraphics().updateCancerNameLabel();
            //chen.yuguo 姓名跑偏问题
            this.getGraphics().updateNameLabel();
           this.getGraphics().updateEvaluatedInfoLabel();
           this.getGraphics().updateCommentsLabel();    
    },
    getGeneticRxaSyndrome: function() {
  		return this._geneticRxaSyndrome;
    },
    setGeneticRxaSyndrome: function(reason) {
        this.openCancerWindow(1);
    },
    getGeneticLcaSyndrome: function() {
  		return this._geneticLcaSyndromel
    },
    setGeneticLcaSyndrome: function(reason) {
        this.openCancerWindow(2);
    },
    getGeneticZgnmaSyndrome: function() {
  		return this._geneticZgnmaSyndrome;
    },
    setGeneticZgnmaSyndrome: function(reason) {
        this.openCancerWindow(5);
    },
    getGeneticJzcaSyndrome: function() {
  		return this._geneticJzcaSyndrome;
    },
    setGeneticJzcaSyndrome: function(reason) {
        this.openCancerWindow(3);
    },
    getGeneticWaSyndrome: function() {
  		return this._geneticWaSyndrome;
    },
    setGeneticWaSyndrome: function(reason) {
        this.openCancerWindow(4);
    },
    getGeneticQlxaSyndrome: function() {
     		return this._geneticQlxaSyndrome;
    },
    setGeneticQlxaSyndrome: function(reason) {
        this.openCancerWindow(6);
    },
    getGeneticSaSyndrome: function() {
  		return this._geneticSaSyndrome;
    },
    setGeneticSaSyndrome: function(reason) {
        this.openCancerWindow(9);
    },
    getGeneticJzxaSyndrome: function() {
    		return this._geneticJzxaSyndrome;
    },
    setGeneticJzxaSyndrome: function(reason) {
        this.openCancerWindow(8);
    },
    getGeneticYxaSyndrome: function() {
     	return this._geneticYxaSyndrome;
    },
    setGeneticYxaSyndrome: function() {
        this.openCancerWindow(7);
    },
    
	inactiveHighRelativeCancer: function() {
        return (this.isHighRelativeCancer() && this._cancerTypes == 'cancertype1');
    },
    inactiveUrogenitalTumor: function() {
        return (this._cancerTypes == 'cancertype2');
    },
    inactiveGastrointestinalTumor: function() {
        return (this._cancerTypes == 'cancertype3');
    },
    inactiveOtherTumor: function() {
        return (this._cancerTypes == 'cancertype4');
    },
    inactiveRareTumor: function() {
        return (this._cancerTypes == 'cancertype5');
    },
    inactiveRxa: function() {
        //return (this.isHighRelativeCancer() && this._highRelativeCancerName == 'highcancer_rxa');
        return false;
    },
    inactiveLca: function() {
        // return (this.isHighRelativeCancer() && this._highRelativeCancerName == 'highcancer_lca');
        return false;
    },
    inactiveZgnma: function() {
        // return (this.isHighRelativeCancer() && this._highRelativeCancerName == 'highcancer_zgnma');
        return false;
    },
    inactiveJzca: function() {
        // return (this.isHighRelativeCancer() && this._highRelativeCancerName == 'highcancer_jzca');
        return false;
    },
    inactiveWa: function() {
        // return (this.isHighRelativeCancer() && this._highRelativeCancerName == 'highcancer_wa');
        return false;
    },
    inactiveQlxa: function() {
        // return (this.isHighRelativeCancer() && this._highRelativeCancerName == 'highcancer_qlxa');
        return false;
    },
    inactiveSa: function() {
        // return (this.isHighRelativeCancer() && this._highRelativeCancerName == 'highcancer_sa');
        return false;
    },
    inactiveJzxa: function() {
        // return (this.isHighRelativeCancer() && this._highRelativeCancerName == 'highcancer_jzxa');
        return false;
    },
    inactiveYxa: function() {
        // return (this.isHighRelativeCancer() && this._highRelativeCancerName == 'highcancer_yxa');
        return false;
    },
    /**
     *
     * @method getConceptionDate
     * @return {Date}
     */
    getConceptionDate: function() {
        return this._conceptionDate;
    },
    /**
     *
     * @method setConceptionDate
     * @param {Date} newDate Date of conception
     */
    setConceptionDate: function(newDate) {
        this._conceptionDate = newDate ? (new Date(newDate)) : '';
        //this.getGraphics().updateAgeLabel();
    },
    /**
     *
     * @method getGestationAge
     * @return {Number}
     */
    getGestationAge: function() {
        if(this.getLifeStatus() == 'unborn' && this.getConceptionDate()) {
            var oneWeek = 1000 * 60 * 60 * 24 * 7,
                lastDay = new Date();
            return Math.round((lastDay.getTime() - this.getConceptionDate().getTime()) / oneWeek)
        }
        else if(this.isFetus()){
            return this._gestationAge;
        }
        else {
            return null;
        }
    },
    /**
     *
     * @method setGestationAge
     * @param {Number} numWeeks Greater than or equal to 0
     */
    setGestationAge: function(numWeeks) {
        try {
            numWeeks = parseInt(numWeeks);
        } catch (err) {
            numWeeks = "";
        }
        if(numWeeks){
            this._gestationAge = numWeeks;
            var daysAgo = numWeeks * 7,
                d = new Date();
            d.setDate(d.getDate() - daysAgo);
            //this.setConceptionDate(d);
        }
        else {
            this._gestationAge = "";
            //this.setConceptionDate(null);
        }
        //this.getGraphics().updateAgeLabel();
        this.getGraphics().updateNameLabel();
        this.getGraphics().updateEvaluatedInfoLabel();
        this.getGraphics().updateCommentsLabel();  
    },

    /**
     *
     * @method getBirthDate
     * @return {Date}
     */
    getBirthDate: function() {
        return this._birthDate;
    },

    /**
     *
     * @method setBirthDate
     * @param {Date} newDate
     */
    setBirthDate: function(newDate) {
        newDate = newDate ? (new Date(newDate)) : '';
        if (!newDate || !this.getDeathDate() || newDate.getTime() < this.getDeathDate().getTime()) {
            this._birthDate = newDate;
            //this.getGraphics().updateAgeLabel();
        }
    },

    /**
     *
     * @method getDeathDate
     * @return {Date}
     */
    getDeathDate: function() {
        return this._deathDate;
    },

    /**     *
     *
     * @method setDeathDate
     * @param {Date} deathDate 
     */
    setDeathDate: function(deathDate) {
        deathDate = deathDate ? (new Date(deathDate)) : '';
        if(!deathDate || !this.getBirthDate() || deathDate.getTime() > this.getBirthDate().getTime()) {
            this._deathDate =  deathDate;
            this._deathDate && (this.getLifeStatus() == 'alive') && this.setLifeStatus('deceased');
        }
        //this.getGraphics().updateAgeLabel(); 
        return this.getDeathDate();
    },

    _isValidCarrierStatus: function(status) {
        return (status == '' || status == 'carrier'
            || status == 'affected' || status == 'presymptomatic');
    },

    /**
     *
     * @method setCarrier
     * @param status One of {'', 'carrier', 'affected', 'presymptomatic'}
     */
    setCarrierStatus: function(status) {
        var numDisorders = this.getDisorders().length;		
        if (status === undefined || status === null) {
            if (numDisorders == 0) {
                status = ""
            } else {
                status = this.getCarrierStatus();
                if (status == "") {
                    status = "affected";
                }
            }
        }

        if (!this._isValidCarrierStatus(status)) return;

        if (numDisorders > 0 && status == '') {
            if (numDisorders == 1 && this.getDisorders()[0] == "affected") { 
                this.removeDisorder("affected");
                this.getGraphics().updateDisorderShapes();
            } else {
                status = 'affected';
            }
        } else if (numDisorders == 0 && status == 'affected') {
            this.addDisorder("affected");
            this.getGraphics().updateDisorderShapes();
            this.getGraphics().updateCarrierGraphic();
        } else if (status == 'carrier'&& numDisorders == 1 && this.getDisorders()[0] == "affected"){
                this.removeDisorder("affected");
        		this.getGraphics().updateDisorderShapes();
        		this.getGraphics().updateCarrierGraphic();
        }

        if (status != this._carrierStatus) {
            this._carrierStatus = status;
            this.getGraphics().updateCarrierGraphic();
        }
    },

    /**
     *
     * @method getCarrier
     * @return {String} 
     */
    getCarrierStatus: function() {
        return this._carrierStatus;
    },

    /**
     * @method getAllNodeColors
     * @return {Array of Strings}
     */
    getAllNodeColors: function() {
    		
        var result = [];
        for (var i = 0; i < this.getDisorders().length; i++) {
            result.push(editor.getDisorderLegend().getObjectColor(this.getDisorders()[i]));
        }
        for (var i = 0; i < this.getGenes().length; i++) {
            result.push(editor.getGeneLegend().getObjectColor(this.getGenes()[i]));
        }
        return result;
    },
    getAllCancerColors: function() {
        var result = [];
        for (var i = 0; i < this.getDisorders().length; i++) {
            result.push(editor.getDisorderLegend().getObjectColor(this.getDisorders()[i]));
        }
        for (var i = 0; i < this.getGenes().length; i++) {
            result.push(editor.getGeneLegend().getObjectColor(this.getGenes()[i]));
        }
        return result;
    },

    /**
     *
     * @method getDisorders
     * @return {Array} List of disorder IDs.
     */
    getDisorders: function() {
        return this._disorders;
    },
    getdisorders:function () {
        return this.nowdisorders;
    },
    /**
     * edit by GJK
     * @method getDisorders
     * @return {Array} List of disorder IDs.
     */
    getCancer: function() {
        return this._cancer;
    },

    /**
     *
     * @method getDisordersForExport
     * @return {Array} 
     */
    getDisordersForExport: function() {
        var exportDisorders = this._disorders.slice(0);
        for (var i = 0; i < exportDisorders.length; i++) {
            exportDisorders[i] = Disorder.desanitizeID(exportDisorders[i]);
        }
        return exportDisorders;
    },
    /**
     * @method addDisorder
     * @param {Disorder} 
     */
    //lizhen 2018-05-21 添加部位参数 bPart
    addDisorder: function(disorder,age,ageType,bPart,cancerId) {
        /**
         * edit by GJK
         */
        if(typeof disorder=='undefined' || typeof disorder=='null')
            return false;
        if (typeof disorder == 'object'){
            age = age ? age :disorder._age;
            ageType = ageType ? ageType  :  disorder._ageType;
            bPart = bPart ? bPart : disorder._bPart;
            cancerId = cancerId ? cancerId :disorder._cancerId;
            cancer={
                cancerType:this.getCurrentCancerType(disorder._disorderID),
                cancerId : cancerId,
                id : disorder._disorderID,
                name : disorder._name,
                age : age,
                ageType : ageType,
                bPart : bPart
            }
        };
        if( typeof  disorder == 'string'){
            age=age?age:this.getCancerAgeNum();
            ageType=ageType?ageType:this.getCancerAgeType();
            bPart = bPart ? bPart : this.getSiteOfCancerValue();
            cancerId = cancerId ? cancerId : this.getCancerId();
            disorder = editor.getDisorderLegend().getDisorder(disorder,age,ageType,bPart,cancerId);
            cancer={
                cancerType:this.getCurrentCancerType(disorder.getDisorderID()),
                id:disorder.getDisorderID(),
                name:disorder.getName(),
                age:disorder.getAge(),
                ageType:disorder.getAgeType(),
                bPart : disorder.getBpart(),
                cancerId : disorder.getCancerId()
            };

        }

        if(disorder._disorderID){
            if(!this.hasDisorder(disorder,"add")){
                var nowDisorder={
                    id:disorder.getDisorderID(),
                    bPart:disorder.getBpart(),
                    age : disorder.getAge()
                };
                this.getdisorders().push(nowDisorder);
                this.getCancer().push(cancer);
                this.getDisorders().push(disorder.getDisorderID());
            }
        }else if(disorder.id){
            if(!this.hasDisorder(disorder,"remove")){
                // var nowDisorder={
                //     id:disorder.getDisorderID(),
                //     bPart:disorder.getBpart()
                // };
                // this.getdisorders().push(nowDisorder);
                this.getCancer().push(cancer);
                this.getDisorders().push(disorder.id);
            }
        }
        
        // if(!this.hasDisorder(disorder.getDisorderID())) {
        //     this.getCancer().push(cancer);
        //     this.getDisorders().push(disorder.getDisorderID());
        // }
        //
        // else {
        //     this_cancer=this.getCancer();
        //     for(i=0;i<this_cancer.length;i++)
        //     {
        //         if(this_cancer[i].id==cancer.id)
        //             this_cancer[i]=cancer;
        //     }
        // }

        if (this.getdisorders().length > 1) {
            this._disorders = this.getDisorders().without('affected');
        }
    },
    /**
     *
     * @method removeDisorder
     * @param {Number} disorderID 
     */
    removeDisorder: function(disorderID) {
        ////
        ////
        //2018-05-25源代码
        // if(this.hasDisorder(disorderID)) {

        //     cancer=[];
        //     for(i=0;i<this._cancer.length;i++)
        //     {
        //         if(this._cancer[i].id!=disorderID)
        //            cancer.push(this._cancer[i]);
        //     }
        //     this._cancer=cancer;

        //     editor.getDisorderLegend().removeCase(disorderID, this.getID());
        //     this._disorders = this.getDisorders().without(disorderID);
        //     //editor.getDisorderLegend().removeDisorder(disorderID);
        // }
        // else {
        //     if (disorderID != "affected") {
        //         alert("此病历已存在");
        //     }
        // }
        //lizhen 2018-05-25 
        if(this.hasDisorder(disorderID,"remove")){
            var cancer=[];
            for(var i=0;i<this._cancer.length;i++){
                if(this._cancer[i].id !=disorderID.id || this._cancer[i].bPart !=disorderID.bPart ||  this._cancer[i].age !=disorderID.age){
                    cancer.push(this._cancer[i]);
                }
            }
            this._cancer = cancer;
            editor.getDisorderLegend().removeCase(disorderID.id, this.getID());
            this._disorders = this.getDisorders().without(disorderID.id);
            for(var i=0;i<this.getdisorders().length;i++){
                if(this.getdisorders()[i].id == disorderID.id && this.getdisorders()[i].bPart == disorderID.bPart &&  this.getdisorders()[i].age == disorderID.age){
                    this.getdisorders().splice(i, 1);
                }
            }
        }else{
            if (disorderID != "affected") {
                alert("此病历已存在");
            }else{
                editor.getDisorderLegend().removeCase("affected", this.getID());
                for(var i=0;i<this.getdisorders().length;i++){
                    if(this.getdisorders()[i].id == "affected"){
                        this.getdisorders().splice(0,1);
                    }
                }
                this._disorders = this.getDisorders().without("affected");
                for(var i=0;i<this._cancer.length;i++){
                    if(this._cancer[i].id=="affected"){
                        this._cancer.splice(i,1);
                    }
                }
            }
        }
    },

    /**
     *
     * @method setDisorders
     * @param {Array} 
     */
    setDisorders: function(disorders,cancer) {
        console.log("---------------------");
        console.log(cancer);
        console.log(disorders);
        console.log("---------------------");
        //源代码
        // for(var i = this.getDisorders().length-1; i >= 0; i--) {
        //     this.removeDisorder( this.getDisorders()[i] );
        // }
        //lizhen 2018-05-25 
        for(var i = this.getdisorders().length-1; i >= 0; i--) {
            this.removeDisorder( this.getdisorders()[i] );
        }

        if(typeof(cancer)!="undefined"&&cancer.length)
        {
            for(var i = 0; i < cancer.length; i++) {
                this.addDisorder( cancer[i].id,cancer[i].age,cancer[i].ageType,cancer[i].bPart,cancer[i].cancerId);
            }
        }
        else {
            for (var i = 0; i < disorders.length; i++) {
                this.addDisorder(disorders[i]);
            }
        }

        this.getGraphics().updateDisorderShapes();
        this.setCarrierStatus();
        var remaindisorder = this.getDisorders();
        var remaincancer=this.getCancer();
        if(remaindisorder == 0){
            this.setCancerTypes(null);
            this.getGraphics().updateCancerNameLabel();
        }
        else {
            theLastDisorder = remaindisorder[remaindisorder.length - 1];
            theLastCancer=remaincancer[remaincancer.length-1];
            if(this._isValidHighRelativeCancerName(theLastDisorder)){this.setHighRelativeCancerName(theLastDisorder,theLastCancer);}
            else if(this._isValidUrogenitalTumorName(theLastDisorder)){this.setUrogenitalTumorName(theLastDisorder,theLastCancer);}
            else if(this._isValidGastrointestinalTumorName(theLastDisorder)){this.setGastrointestinalTumorName(theLastDisorder,theLastCancer);}
            else if(this._isValidOtherTumorName(theLastDisorder)){this.setOtherTumorName(theLastDisorder,theLastCancer);}
            else if(this._isValidRareTumorName(theLastDisorder)){this.setRareTumorName(theLastDisorder,theLastCancer);}
            if(theLastDisorder!='affected'&&theLastDisorder)
                this.getGraphics().updateCancerNameLabel(theLastCancer.name,theLastCancer.age,theLastCancer.ageType,theLastCancer.bPart);
        }

    },
    /**
     *
     * @method getHPO
     * @return {Array} 
     */
    getHPO: function() {
        return this._hpo;
    },

    /**
     *
     * @method getHPOForExport
     * @return {Array} 
     */
    getHPOForExport: function() {
        var exportHPOs = this._hpo.slice(0);
        for (var i = 0; i < exportHPOs.length; i++) {
            exportHPOs[i] = HPOTerm.desanitizeID(exportHPOs[i]);
        }
        return exportHPOs;
    },

    /**
     *
     * @method addHPO
     * @param {HPOTerm} 
     */
    addHPO: function(hpo) {
        if (typeof hpo != 'object') {
            hpo = editor.getHPOLegend().getTerm(hpo);
        }
        if(!this.hasHPO(hpo.getID())) {
            editor.getHPOLegend().addCase(hpo.getID(), hpo.getName(), this.getID());
            this.getHPO().push(hpo.getID());
        }
        else {
            alert("此人已经有指定表型");
        }
    },

    /**
     *
     * @method removeHPO
     * @param {Number} 
     */
    removeHPO: function(hpoID) {
        if(this.hasHPO(hpoID)) {
            editor.getHPOLegend().removeCase(hpoID, this.getID());
            this._hpo = this.getHPO().without(hpoID);
        }
        else {
            alert("This person doesn't have the specified HPO term");
        }
    },

    /**
     *
     * @method setHPO
     * @param {Array} hpos List of HPOTerm objects
     */
    setHPO: function(hpos) {
        for(var i = this.getHPO().length-1; i >= 0; i--) {
            this.removeHPO( this.getHPO()[i] );
        }
        for(var i = 0; i < hpos.length; i++) {
            this.addHPO( hpos[i] );
        }
    },
    /**
     * @method hasHPO
     * @param {Number} id 
     */
    hasHPO: function(id) {
        return (this.getHPO().indexOf(id) != -1);
    },













    /**
     *
     * @method setEthnicities
     * @param {Array} ethnicities List of ethnicity names (as strings)
     */
    setEthnicities: function(ethnicities) {
        this._ethnicities = ethnicities;
    },

    /**
     *
     * @method getEthnicities
     * @return {Array} List of ethnicity names.
     */
    getEthnicities: function() {
        return this._ethnicities;
    },





    /**
     *
     * @method addGenes
     */
    addGene: function(gene) {
        if (this.getGenes().indexOf(gene) == -1) {
            //editor.getGeneLegend().addCase(gene, gene, this.getID());
            this.getGenes().push(gene);
        }
    },

    /**
     *
     * @method removeGene
     */
    removeGene: function(gene) {
        if (this.getGenes().indexOf(gene) !== -1) {
            editor.getGeneLegend().removeCase(gene, this.getID());
            this._candidateGenes = this.getGenes().without(gene);
        }
    },

    /**
     *
     * @method setGenes
     * @param {Array} genes List of gene names (as strings)
     */
    setGenes: function(genes) {
        for(var i = this.getGenes().length-1; i >= 0; i--) {
            this.removeGene(this.getGenes()[i]);
        }
        for(var i = 0; i < genes.length; i++) {
            this.addGene( genes[i] );
        }
        //this.getGraphics().updateDisorderShapes();
    },

    /**
     *
     * @method getGenes
     * @return {Array} List of gene names.
     */
    getGenes: function() {
        return this._candidateGenes;
    },





    /**
     *
     * @method remove
     * @param [skipConfirmation=false] {Boolean} 
     */
    remove: function($super) {
        this.setDisorders([]);    
        //===
        this.setHPO([]);
        this.setGenes([]);
        $super();
    },

    /**
     *
     * @method getDisorderByID
     * @param {Number} id Disorder ID
     * @return {Disorder}
     */

    hasDisorder: function(obj,flag) {
        var ret = false;
        for(var i=0;i<this.getdisorders().length;i++){ 
            if(flag){
                if(flag == "add"){
                    if(this.getdisorders()[i].id==obj._disorderID && this.getdisorders()[i].bPart==obj._bPart && this.getdisorders()[i].age==obj._age){
                        ret = true;
                        break;
                    }
                }else if(flag == "remove"){
                    if(this.getdisorders()[i].id==obj.id && this.getdisorders()[i].bPart==obj.bPart && this.getdisorders()[i].age==obj.age){
                        ret = true;
                        break;
                    }
                }
            }else{
                if(this.getdisorders()[i].id==obj.id && this.getdisorders()[i].bPart==obj.bPart && this.getdisorders()[i].age==obj.age){
                    ret = true;
                    break;
                }
            }
            
        }
        return ret;
        // return (this.getDisorders().indexOf(id) != -1);
    },
    /**
     *
     * @method setChildlessStatus
     * @param {String} status 
     * @param {Boolean} ignoreOthers 
     */
    setChildlessStatus: function(status) {
    	
        if(!this.isValidChildlessStatus(status))
            status = null;
        if(status != this.getChildlessStatus()) {
            this._childlessStatus = status;
            this.setChildlessReason(null);
            this.getGraphics().updateChildlessShapes();
            this.getGraphics().getHoverBox().regenerateHandles();
        }
        return this.getChildlessStatus();
    },
    setSyndromeRate:function (data) {
        this._syndromeRate=data;
    },
    getSyndromeRate:function () {
        return this._syndromeRate;
    },
    /**
     *
     * @method getSummary
     * @return {Object} Summary 
     */
    getSummary: function() {
        
        var onceAlive = editor.getGraph().hasRelationships(this.getID());
        var inactiveStates = onceAlive ? ['unborn','aborted','miscarriage','stillborn'] : false;
        if(this.isProband()) {
            inactiveStates = ['unborn','aborted','miscarriage','stillborn'];
        }
        var inactiveGenders = false;
        var inactiveCancerTypes = false;
        var inactiveHighRelativeCancer = false;
        var inactiveUrogenitalTumor = false;
        var inactiveGastrointestinalTumor = false;
        var inactiveOtherTumor = false;
        var inactiveRareTumor = false;
        
        var inactiveRxa = false;
        var inactiveLca = false;
        var inactiveZgnma = false;
        var inactiveJzca = false;
        var inactiveWa = false;
        var inactiveQlxa = false;
        var inactiveSa = false;
        var inactiveJzxa = false;
        var inactiveYxa = false;
        var isprobandnum = false;
        if(this.isProband()) {
        		isprobandnum = true;
        }
        //==
        var genderSet = editor.getGraph().getPossibleGenders(this.getID());
        for (gender in genderSet)
            if (genderSet.hasOwnProperty(gender))
                if (!genderSet[gender])
                    inactiveGenders = [ gender ];

        var childlessInactive = this.isFetus();  
                                                 
        var disorders = [];
        var cancer=this.getCancer();
        this.getDisorders().forEach(function(disorder,index) {
            if(typeof disorder!='undefined') {
                disorder_obj=editor.getDisorderLegend().getDisorder(disorder,cancer[index].age,cancer[index].ageType,cancer[index].bPart,cancer[index].cancerId);
                //var disorderName = editor.getDisorderLegend().getDisorder(disorder, cancer).getName();
                //var age = editor.getDisorderLegend().getDisorder(disorder, cancer).getAge();
                //var ageType = editor.getDisorderLegend().getDisorder(disorder, cancer).getAgeType();
                disorders.push({id: disorder, value: disorder_obj.getName(), age: disorder_obj.getAge(), ageType: disorder_obj.getAgeType(),bPart:disorder_obj.getBpart(),cancerId:disorder_obj.getCancerId()});
            }
        });
                
        var hpoTerms = [];
        this.getHPO().forEach(function(hpo) {
            var termName = editor.getHPOLegend().getTerm(hpo).getName();
            hpoTerms.push({id: hpo, value: termName});
        });
        var cantChangeAdopted = this.isFetus() || editor.getGraph().hasToBeAdopted(this.getID());

        
        var inactiveMonozygothic = true;
        var disableMonozygothic  = true;
        //===
        var inactiveUnknownzygotic = true;
        var disableUnknownzygotic  = true;
        
        var twins = editor.getGraph().getAllTwinsSortedByOrder(this.getID());
        if (twins.length > 1) {
            inactiveMonozygothic = false;
            disableMonozygothic  = false;
            //===
           	inactiveUnknownzygotic = false;
        		disableUnknownzygotic  = false;
            
            for (var i = 0; i < twins.length; i++) {
                if (editor.getGraph().getGender(twins[i]) != this.getGender()) {
                    disableMonozygothic = true;
        				disableUnknownzygotic  = true;
                    break;
                }
            }
        }

        var inactiveCarriers = [];
        if (disorders.length > 0) {
            if (disorders.length != 1 || disorders[0].id != "affected") {
                inactiveCarriers = [''];//已患癌禁止未受影响者
            }
        }
        if (this.getLifeStatus() == "aborted" || this.getLifeStatus() == "miscarriage") {
            inactiveCarriers.push('presymptomatic');
        }

        var inactiveLostContact = this.isProband() || !editor.getGraph().isRelatedToProband(this.getID());

        return {
            identifier:    {value : this.getID()},
            first_name:    {value : this.getFirstName()},
            familyUserId :    {value : this.getMpersonId()},
            //个人资料
            tel_num:		   {value : this.getTelephone(), disabled: isprobandnum},
            born_addr:	   {value : this.getBornAddr()},
            ethnicityname: {value : this.getEthnicityName()},
            curent_age:	   {value : this.getCurentAge()},
            death_age:	   {value : this.getDeathAge()},
            deceasedText:  {value : this.getDeceasedReason()},
            probability:   {value : this.getProbability()},
            date_of_add:   {value : this.getAddDate()},
            
            
            
            last_name:     {value : this.getLastName()},
            last_name_birth: {value: this.getLastNameAtBirth()}, //, inactive: (this.getGender() != 'F')},
            external_id:   {value : this.getExternalID(), disabled:true },
            gender:        {value : this.getGender(), inactive: inactiveGenders},
            date_of_birth: {value : this.getBirthDate(), inactive: this.isFetus()},
            carrier:       {value : this.getCarrierStatus(), disabled: inactiveCarriers},
            //carrier:       {value : this.getCarrierStatus(), disabled: ['affected']},//禁止radio的值
            
            disorders:     {value : disorders},
            cancer:       {value:this.getCancer()},
            //===癌症历史
            
            
            ethnicity:     {value : this.getEthnicities()},
            candidate_genes: {value : this.getGenes()},
            adopted:       {value : this.isAdopted(), inactive: cantChangeAdopted},
            state:         {value : this.getLifeStatus(), inactive: inactiveStates},
            date_of_death: {value : this.getDeathDate(), inactive: this.isFetus()},
            comments:      {value : this.getComments(), inactive: false},
            gestation_age: {value : this.getGestationAge(), inactive : !this.isFetus()},
            //===
            
            canceragetype:  {value : this.getCancerAgeType()},
            cancerAgeType:  {value : this.getCancerAgeType()},
            canceragenum:   {value : this.getCancerAgeNum(), inactive: inactiveCancerTypes, disabled : !this.getCancerAgeType()},// inactive: !inactiveCancerTypes disabled : !this.getCancerAgeType()
            cancerAgeNum:   {value : this.getCancerAgeNum(), inactive: inactiveCancerTypes, disabled : !this.getCancerAgeType()},// inactive: !inactiveCancerTypes disabled : !this.getCancerAgeType()
            setcancertypes:  {value : this.getCancerTypes()},
            cancerTypes:  {value : this.getCancerTypes()},
            high_relative_cancer:  {value : this.getHighRelativeCancerName(), inactive : !this.inactiveHighRelativeCancer()},
            highRelativeCancer:  {value : this.getHighRelativeCancerName(), inactive : !this.inactiveHighRelativeCancer()},
            urogenital_tumor:  {value : this.getUrogenitalTumorName(), inactive : !this.inactiveUrogenitalTumor()},
            urogenitalTumor:  {value : this.getUrogenitalTumorName(), inactive : !this.inactiveUrogenitalTumor()},
            gastrointestinal_tumor:  {value : this.getGastrointestinalTumorName(), inactive : !this.inactiveGastrointestinalTumor()},
            gastrointestinalTumor:  {value : this.getGastrointestinalTumorName(), inactive : !this.inactiveGastrointestinalTumor()},
            other_tumor:  {value : this.getOtherTumorName(), inactive : !this.inactiveOtherTumor()},
            otherTumor:  {value : this.getOtherTumorName(), inactive : !this.inactiveOtherTumor()},
            rare_tumor:  {value : this.getRareTumorName(), inactive : !this.inactiveRareTumor()},
            rareTumor:  {value : this.getRareTumorName(), inactive : !this.inactiveRareTumor()},
            genetic_syndrome_rxa:  {value : this.getGeneticRxaSyndrome(), inactive : !this.inactiveRxa()},
            genetic_syndrome_lca:  {value : this.getGeneticLcaSyndrome(), inactive : !this.inactiveLca()},
            genetic_syndrome_zgnma:  {value : this.getGeneticZgnmaSyndrome(), inactive : !this.inactiveZgnma()},
            genetic_syndrome_jzca:  {value : this.getGeneticJzcaSyndrome(), inactive : !this.inactiveJzca()},
            genetic_syndrome_wa:  {value : this.getGeneticWaSyndrome(), inactive : !this.inactiveWa()},
            genetic_syndrome_qlxa:  {value : this.getGeneticQlxaSyndrome(), inactive : !this.inactiveQlxa()},
            genetic_syndrome_sa:  {value : this.getGeneticSaSyndrome(), inactive : !this.inactiveSa()},
            genetic_syndrome_jzxa:  {value : this.getGeneticJzxaSyndrome(), inactive : !this.inactiveJzxa()},
            genetic_syndrome_yxa:  {value : this.getGeneticYxaSyndrome(), inactive : !this.inactiveYxa()},
            genetic_syndrome:		{value : this.getGeneticSyndrome()},
            //新增部位与添加部位按钮 lizhen
            site_of_cancer:{value: this.getSiteOfCancerValue(), inactive : !this.getCancerTypes()},
            cancer_is_ok:{value: this.getCancerSite(), inactive : !this.getCancerTypes()},
            cancerId : {value : this.getCancerId()},
            //上传图片，文件，chen.yuguo
            genetic_file:       {value : this.getGeneticFile()},

            //===
            childlessSelect: {value : this.getChildlessStatus() ? this.getChildlessStatus() : 'none', inactive : childlessInactive},
            childlessText:   {value : this.getChildlessReason() ? this.getChildlessReason() : undefined, inactive : childlessInactive, disabled : !this.getChildlessStatus()},
            placeholder:   {value : false, inactive: true },
            monozygotic:   {value : this.getMonozygotic(), inactive: inactiveMonozygothic, disabled: disableMonozygothic },
            //===
            unknownzygotic:   {value : this.getUnknownzygotic(), inactive: inactiveUnknownzygotic, disabled: disableUnknownzygotic },
            
            evaluated:     {value : this.getEvaluated() },
            //===
            evaluatedinfo:     {value : this.getEvaluatedInfo() },
            //===
            precursor: {value : this.getProband()},
            
            hpo_positive:  {value : hpoTerms},
            nocontact:     {value : this.getLostContact(), inactive: inactiveLostContact},
            syndrome_rate:{value:this.getSyndromeRate()},
        };
    },

    /**
     * except id, x, y & type
     *
     * @method getProperties
     * @return {Object} in the form
     *
     {
       property: value
     }
     */
    getProperties: function($super) {
        var info = $super();
        if (this.getFirstName() != "")
            info['fName'] = this.getFirstName();
        if (this.getAddDate() != "")
            info['dateOfAdd'] = this.getAddDate();
        if (this.getTelephone() != "")
            info['telNum'] = this.getTelephone();
        if (this.getBornAddr() != "")
            info['bornAddr'] = this.getBornAddr();
        if (this.getEthnicityName() != "")
            info['ethnicityName'] = this.getEthnicityName();
        if (this.getCurentAge() != "")
            info['curentAge'] = this.getCurentAge();
        if (this.getDeathAge() != "")
            info['deathAge'] = this.getDeathAge();
        if (this.getDeceasedReason() != "")
            info['deceasedText'] = this.getDeceasedReason();
        if (this.getProbability() != "")
            info['probability'] = this.getProbability();
        if (this.getSyndromeRate() != "")
            info['syndromeRate'] = this.getSyndromeRate();
        if (this.getLastName() != "")
            info['lName'] = this.getLastName();
        if (this.getLastNameAtBirth() != "")
            info['lNameAtB'] = this.getLastNameAtBirth();
        if (this.getExternalID() != "")
            info['externalID'] = this.getExternalID();
        if (this.getMemberID()!='')
            info['memberID']=this.getMemberID();
        if (this.getBirthDate() != "")
            info['dob'] = this.getBirthDate().toDateString();
        if (this.isAdopted())
            info['isAdopted'] = this.isAdopted();
        if (this.getLifeStatus() != 'alive')
            info['lifeStatus'] = this.getLifeStatus();
        if (this.getCancerAgeType() != "nullValue")
            info['cancerAgeType'] = this.getCancerAgeType();
        if (this.getCancerAgeNum() != "")
            info['cancerAgeNum'] = this.getCancerAgeNum();
        if (this.getCancerTypes() != 'nullValue')
            info['cancerTypes'] = this.getCancerTypes();
        if (this.getHighRelativeCancerName() != 'nullValue')
            info['highRelativeCancerName'] = this.getHighRelativeCancerName();            
         if (this.getUrogenitalTumorName() != 'nullValue')
            info['urogenitalTumorName'] = this.getUrogenitalTumorName();
         if (this.getGastrointestinalTumorName() != 'nullValue')
            info['gastrointestinalTumorName'] = this.getGastrointestinalTumorName();
         if (this.getOtherTumorName() != 'nullValue')
            info['otherTumorName'] = this.getOtherTumorName();
         if (this.getRareTumorName() != 'nullValue')
            info['rareTumorName'] = this.getRareTumorName();
         //新增部位文本框 lizhen
         if(this.getSiteOfCancerValue() != "")
            info['getSiteOfCancerValue'] = this.getSiteOfCancerValue();
        if(this.getCancerId() != ""){
            info['cancerId'] = this.getCancerId();
        }
        if(this.getProband()){
            info['precursor'] = 1;
        }else{
            info['precursor'] = 0;
        }
         //setUnknownzygotic
        //===
        if (this.getDeathDate() != "")
            info['dod'] = this.getDeathDate().toDateString();
        if (this.getGestationAge() != null)
            info['gestationAge'] = this.getGestationAge();
        if (this.getChildlessStatus() != null) {
            info['childlessStatus'] = this.getChildlessStatus();
            info['childlessReason'] = this.getChildlessReason();
        }
        if (this.getDisorders().length > 0)
            info['disorders'] = this.getDisordersForExport();
        if (this.getCancer().length > 0)
            info['cancer'] = this.getCancer();
        //===癌症历史
            
        if (this.getHPO().length > 0)
            info['hpoTerms'] = this.getHPOForExport();
        if (this.getEthnicities().length > 0)
            info['ethnicities'] = this.getEthnicities();
        if (this.getGenes().length > 0)
            info['candidateGenes'] = this.getGenes();
        if (this._twinGroup !== null)
            info['twinGroup'] = this._twinGroup;
        if (this._monozygotic)
            info['monozygotic'] = this._monozygotic;
        if (this._unknownzygotic)
            info['unknownzygotic'] = this._unknownzygotic;
        
        if (this._evaluated)
            info['evaluated'] = this._evaluated;
        //===
        //if (this._evaluatedinfo)
        //    info['evaluatedinfo'] = this._evaluatedinfo;
        if (this.getEvaluatedInfo() != "")
            info['evaluatedinfo'] = this.getEvaluatedInfo();
        
        //===
            
            
            
        if (this._carrierStatus)
            info['carrierStatus'] = this._carrierStatus;
        if (this.getLostContact())
            info['lostContact'] = this.getLostContact();
        if (this.getPedNumber() != "")
            info['nodeNumber'] = this.getPedNumber();
        if(this.getMpersonId() != ""){
            info['familyUserId'] = this.getMpersonId();
        }
        return info;
     },

     /**
      * 将属性添加到节点
      * @method assignProperties
      * @param properties Object
      * @return {Boolean} True 
      */
     assignProperties: function($super, info) {
        this._setDefault();
        if($super(info)) {
            //加一个成员唯一标识
            if(info.familyUserId && this.getMpersonId() != info.familyUserId ){
                this.setMpersonId(info.familyUserId);
            }else{
                var familyUserId =  this.setCancerUuid();
                this.setMpersonId(familyUserId);
                var allProperties = jQuery.extend(info,{familyUserId : familyUserId})
                editor.getGraph().setProperties(this.getID(), allProperties );
            }
            if(info.fName && this.getFirstName() != info.fName) {
                this.setFirstName(info.fName);
            }
            if(info.dateOfAdd && this.getAddDate() != info.dateOfAdd) {
                this.setAddDate(info.dateOfAdd);
            }
            if(info.telNum && this.getTelephone() != info.telNum) {
                this.setTelephone(info.telNum);
            }
            if(info.bornAddr && this.getBornAddr() != info.bornAddr) {
                this.setBornAddr(info.bornAddr);
            }
            if(info.ethnicityName && this.getEthnicityName() != info.ethnicityName) {
                this.setEthnicityName(info.ethnicityName);
            }
            if(info.curentAge && this.getCurentAge() != info.curentAge) {
                this.setCurentAge(info.curentAge);
            }
            if(info.deathAge && this.getDeathAge() != info.deathAge) {
                this.setDeathAge(info.deathAge);
            }
            if(info.deceasedText && this.getDeceasedReason() != info.deceasedText) {
                this.setDeceasedReason(info.deceasedText);
            }
            if(info.probability && this.getProbability() != info.probability) {
                this.setProbability(info.probability);
            }
            if(info.probability && this.getSyndromeRate() != info.syndromeRate) {
                this.setSyndromeRate(info.probability);
            }
            
            
            
            if(info.lName && this.getLastName() != info.lName) {
                this.setLastName(info.lName);
            }
            if(info.lNameAtB && this.getLastNameAtBirth() != info.lNameAtB) {
                this.setLastNameAtBirth(info.lNameAtB);
            }
            if (info.externalID && this.getExternalID() != info.externalID) {
                this.setExternalID(info.externalID);
            }
            if (info.memberID && this.getMemberID() != info.memberID) {
                this.setMemberID(info.memberID);
            }
            if(info.dob && this.getBirthDate() != info.dob) {
                this.setBirthDate(info.dob);
            }
            if(info.disorders) {
                if(info.cancer)
                    this.setDisorders(info.disorders,info.cancer);
                else {
                    this.setDisorders(info.disorders);
                }
            }

            //===癌症历史
            
            if(info.hpoTerms) {
                this.setHPO(info.hpoTerms);
            }
            if(info.ethnicities) {
                this.setEthnicities(info.ethnicities);
            }
            if(info.candidateGenes) {
                this.setGenes(info.candidateGenes);
            }
            if(info.hasOwnProperty("isAdopted") && this.isAdopted() != info.isAdopted) {
                this.setAdopted(info.isAdopted);
            }
            if(info.hasOwnProperty("lifeStatus") && this.getLifeStatus() != info.lifeStatus) {
                this.setLifeStatus(info.lifeStatus);
            }
            //===
            if(info.hasOwnProperty("cancerAgeType") && this.getCancerAgeType() != info.cancerAgeType) {
                this.setCancerAgeType(info.cancerAgeType);
            }
            
            if(info.cancerAgeNum && this.getCancerAgeNum() != info.cancerAgeNum) {
                this.setCancerAgeNum(info.cancerAgeNum);
            }
            //新增部位文本框 lizhen
            if(info.getSiteOfCancerValue && this.getSiteOfCancerValue() != info.getSiteOfCancerValue){
                this.setSiteOfCancerValue(info.getSiteOfCancerValue);
            }
            if(info.cancerId && this.getCancerId() != info.cancerId){
                this.setCancerId(info.cancerId);
            }
            if(info.hasOwnProperty("cancerTypes") && this.getCancerTypes() != info.cancerTypes) {
                this.getCancerTypes(info.cancerTypes);
            }
            if(info.hasOwnProperty("highRelativeCancerName") && this.getHighRelativeCancerName() != info.highRelativeCancerName) {
                this.getHighRelativeCancerName(info.highRelativeCancerName);
            }
            
            if(info.hasOwnProperty("urogenitalTumorName") && this.getUrogenitalTumorName() != info.urogenitalTumorName) {
                this.getUrogenitalTumorName(info.urogenitalTumorName);
            }
            if(info.hasOwnProperty("gastrointestinalTumorName") && this.getGastrointestinalTumorName() != info.gastrointestinalTumorName) {
                this.getGastrointestinalTumorName(info.gastrointestinalTumorName);
            }
            if(info.hasOwnProperty("otherTumorName") && this.getOtherTumorName() != info.otherTumorName) {
                this.getOtherTumorName(info.otherTumorName);
            }
            if(info.hasOwnProperty("rareTumorName") && this.getRareTumorName() != info.rareTumorName) {
                this.getRareTumorName(info.rareTumorName);
            }
            
            
            //===
            
            
            
            if(info.dod && this.getDeathDate() != info.dod) {
                this.setDeathDate(info.dod);
            }
            if(info.gestationAge && this.getGestationAge() != info.gestationAge) {
                this.setGestationAge(info.gestationAge);
            }
            if(info.childlessStatus && this.getChildlessStatus() != info.childlessStatus) {
                this.setChildlessStatus(info.childlessStatus);
            }
            if(info.childlessReason && this.getChildlessReason() != info.childlessReason) {
                this.setChildlessReason(info.childlessReason);
            }
            if(info.hasOwnProperty("twinGroup") && this._twinGroup != info.twinGroup) {
                this.setTwinGroup(info.twinGroup);
            }
            //===
//          if(info.hasOwnProperty("twinGroup") && this._twinGroup != info.twinGroup) {
//              this.setTwinGroup(info.twinGroup);
//          }
//          if(info.hasOwnProperty("twinGroup") && this._twinGroup != info.twinGroup) {
//              this.setTwinGroup(info.twinGroup);
//          }
//          if(info.hasOwnProperty("twinGroup") && this._twinGroup != info.twinGroup) {
//              this.setTwinGroup(info.twinGroup);
//          }
            //===
            if(info.hasOwnProperty("monozygotic") && this._monozygotic != info.monozygotic) {
                this.setMonozygotic(info.monozygotic);
            }
            //===
            //setUnknownzygotic
            if(info.hasOwnProperty("unknownzygotic") && this._unknownzygotic != info.unknownzygotic) {
                this.setUnknownzygotic(info.unknownzygotic);
            }
            if(info.hasOwnProperty("evaluated") && this._evaluated != info.evaluated) {
                this.setEvaluated(info.evaluated);
            }
           /*lizhen*/
           if(info.hasOwnProperty("precursor") && this._precursor!=info.precursor){
               this.setProband(info.precursor);
           }

           if(info.precursor && this.getProband()!= info.precursor){
               this.setProband(info.precursor);
           }

            if(info.evaluated && this.getEvaluated() != info.evaluated) {
                this.setEvaluated(info.evaluated);
            }
            
            if(info.evaluatedinfo && this.getEvaluatedInfo() != info.evaluatedinfo) {
                this.setEvaluatedInfo(info.evaluatedinfo);
            }
            if(info.hasOwnProperty("carrierStatus") && this._carrierStatus != info.carrierStatus) {
                this.setCarrierStatus(info.carrierStatus);
            }
            if (info.hasOwnProperty("nodeNumber") && this.getPedNumber() != info.nodeNumber) {
                this.setPedNumber(info.nodeNumber);
            }
            if (info.hasOwnProperty("lostContact") && this.getLostContact() != info.lostContact) {
                this.setLostContact(info.lostContact);
            }
            return true;
        }
        return false;
    }
});
var cType={
    "ctypeHigh":{
        "highcancer_rxa":"乳腺癌",
        "highcancer_lca":"卵巢癌",
        "highcancer_zgnma" :"子宫内膜癌",
        "highcancer_jzca" :"结直肠癌",
        "highcancer_wa" :"胃癌",
        "highcancer_sa" :"肾癌",
        "highcancer_qlxa" :"前列腺癌",
        "highcancer_jzxa" :"甲状腺癌",
        "highcancer_yxa" :"胰腺癌"
    }
}
Person.addMethods(ChildlessBehavior);